//
//  FreeManagerSelfThreeTableViewCell.m
//  GLGW_Shoping
//
//  Created by whx on 2018/12/8.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "FreeManagerSelfThreeTableViewCell.h"

@implementation FreeManagerSelfThreeTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        GLGWView *letV = [[GLGWView alloc] initWithInSuperView:self.contentView];
        [letV setViewShadowWidth:3.0 theCornerRadius:12];
        [letV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.right.equalTo(self.contentView.mas_right).offset(-kHeightProportion_In_iPhoneTriploid(15));
            make.top.equalTo(@(kWidthProportion_In_iPhoneTriploid(20)));
//            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(390)));
            make.bottom.equalTo(@(-kHeightProportion_In_iPhoneTriploid(20)));
        }];
        letV.backgroundColor = [UIColor whiteColor];
        
        GLGWLabel *nameLab = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#C8BF9A"] inSuperView:letV];
        NSString *str = @"可提现金额(元)";
        nameLab.text = str;
        [nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(letV.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(letV.mas_top).offset(kHeightProportion_In_iPhoneTriploid(21));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(20)));
        }];
        
        GLGWLabel *moneyLab = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(25) theColor:[UIColor colorWithHexString:@"#A89A60"] inSuperView:letV];
        moneyLab.text = @"66,666.66";
        [moneyLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(nameLab.mas_left);
            make.top.equalTo(nameLab.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(6));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(34)));
            make.right.equalTo(letV.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(85));
        }];
//
        GLGWView *view1 = [[GLGWView alloc] initWithInSuperView:letV];
        [view1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(letV.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(letV.mas_top).offset(kHeightProportion_In_iPhoneTriploid(101));
            make.right.equalTo(letV.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(1)));
        }];
        view1.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
//
        GLGWLabel *lab1 = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:letV];
        lab1.text = @"上月预估收入";
        [lab1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(nameLab.mas_left);
            make.top.equalTo(moneyLab.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(41));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(17)));
        }];

        GLGWLabel *lab2 = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(10) theColor:[UIColor colorWithHexString:@"#A89A60"] inSuperView:letV];
        lab2.text = @"已结算";
        [lab2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(lab1.mas_right).offset(kWidthProportion_In_iPhoneTriploid(12));
            make.top.equalTo(lab1.mas_top).offset(kHeightProportion_In_iPhoneTriploid(3));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(14)));
        }];

        GLGWLabel *lastMouthLab = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(15) theColor:[UIColor colorWithHexString:@"#544040"] inSuperView:letV];
        lastMouthLab.text = @"666.66";
        [lastMouthLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(letV.mas_left).offset(kWidthProportion_In_iPhoneTriploid(29));
            make.top.equalTo(lab2.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(5));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(21)));
        }];

        GLGWLabel *lab3 = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(10) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:letV];
        NSString *str3 = @"  每月20日结算上月预估收入";
        lab3.text = str3;
        lab3.attributedText = [GLGWLabel addImageName:@"icon_tixing" theImageFram:CGRectMake(0, -3, kWidthProportion_In_iPhoneTriploid(14), kHeightProportion_In_iPhoneTriploid(14)) theTextString:str3 atImageIndex:0];
        [lab3 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(lab1.mas_left);
            make.top.equalTo(lastMouthLab.mas_bottom).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(14)));
        }];

        GLGWView *view2 = [[GLGWView alloc] initWithInSuperView:letV];
        [view2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(letV.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.bottom.equalTo(letV.mas_bottom).offset(-kHeightProportion_In_iPhoneTriploid(49));
            make.right.equalTo(letV.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(1)));
        }];
        view2.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];

        GLGWLabel *lab4 = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:letV];
        lab4.text = @"收入明细";
        lab4.numberOfLines = 0;
        [lab4 mas_updateConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(lab1.mas_left);
            make.top.equalTo(lab3.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(40));
            make.bottom.equalTo(@(-kHeightProportion_In_iPhoneTriploid(16)));
        }];

        GLGWImageView *imgV = [[GLGWImageView alloc] initWithImageName:@"icon_chakan" inSuperView:letV];
        [imgV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.equalTo(letV.mas_bottom).offset(-kWidthProportion_In_iPhoneTriploid(17));
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(8)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(14)));
            make.right.equalTo(letV.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
        }];
        imgV.backgroundColor = kRandomColor;

        GLGWView *miV = [[GLGWView alloc] initWithInSuperView:letV];
        [miV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(letV.mas_top).offset(kWidthProportion_In_iPhoneTriploid(131));
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(1)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(24)));
            make.centerX.equalTo(letV.mas_centerX);
        }];
        miV.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];

        GLGWLabel *lab5 = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(10) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:letV];
        lab5.text = @"本月预估收入";
        [lab5 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(miV.mas_right).offset(kWidthProportion_In_iPhoneTriploid(34));
            make.centerY.equalTo(lab1.mas_centerY);
        }];

        GLGWLabel *lab6 = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(10) theColor:[UIColor colorWithHexString:@"#EC5353"] inSuperView:letV];
        lab6.text = @"待结算";
        [lab6 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(lab5.mas_right).offset(kWidthProportion_In_iPhoneTriploid(12));
            make.centerY.equalTo(lab2.mas_centerY);
        }];

        GLGWLabel *nowMouthLab = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#544040"] inSuperView:letV];
        nowMouthLab.text = @"597.61";
        [nowMouthLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(lab5.mas_left).offset(kWidthProportion_In_iPhoneTriploid(13));
            make.centerY.equalTo(lastMouthLab.mas_centerY);
        }];

        GLGWButton *letBtn = [[GLGWButton alloc] initWithTitle:@"提现" titleLableFont:SYSTEMFONT(12) titleLableColor:[UIColor colorWithHexString:@"#FFFFFF"] inSuperView:letV];
        [letBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(letV.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.centerY.equalTo(moneyLab.mas_centerY);
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(70)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(24)));
        }];
        [letBtn setBackgroundColor:kRandomColor];
        letBtn.layer.masksToBounds = YES;
        letBtn.layer.cornerRadius = kHeightProportion_In_iPhoneTriploid(12);
        UIImage *img = [UIImage imageWithStartColor:[UIColor colorWithHexString:@"#B3A877"] endColor:[UIColor colorWithHexString:@"#DAD3AF"]];
        [letBtn setBackgroundImage:img forState:UIControlStateNormal];
        [letBtn addTarget:self action:@selector(leftAction:) forControlEvents:UIControlEventTouchUpInside];
        
    }
    return self;
}

- (void)leftAction:(GLGWButton *)sender
{
    if (self.BlockLeft) {
        self.BlockLeft(sender);
    }
}

- (void)rightAction:(GLGWButton *)sender
{
//    if (self.BlockRight) {
//        self.BlockRight(sender);
//    }
}

@end
